/*******************************************************************************
 *
 *		SIMPLE_MOTION_Code
 *
*******************************************************************************/
#include "cytypes.h"
#include "stdint.h"
//#include "motion_wheel.h"

#ifndef SIMPLE_MOTION_H
#define	SIMPLE_MOTION_H

#define STATE_NOFINGER									0x00 
#define STATE_DOWN											0x01
#define STATE_PRESSED 									0x02 
#define STATE_UP												0x03



//direction
#if 0
#define NO_SLIDER 0x00
#define LEFT   0x01
#define RIGHT  0x02
#define UP     0x03
#define DOWN   0x04
#endif

#define TAP  0x05


#define MOVE_THR            (60)
#define TAP_MOVE_THR        (30)
#define IS_MOVE_THR         (20)


#define  TOUCH_NO_KEY      0
#define  TOUCH_IS_KEY      1
#define  TOUCH_NO_TMPKEY   2




#define  TAP_TIMEOUT  100
#define  Fast_SLIDER_TIMEOUT  70
#define  SLIDER_TIMEOUT   500

#define GESTURE_UP						  1
#define GESTURE_DOWN						2
#define GESTURE_LEFT						3
#define GESTURE_RIGHT  					4
#define GESTURE_POS							5
#define GESTURE_NEG							6
#define GESTURE_OK							7
#define GESTURE_MOUSE_RIGHT			8
#define GESTURE_MOUSE_LEFT			9


typedef struct { 


	uint8 state_flag;


	uint8 uch_P_Cnt;
	
	uint16_t x_pos;
	uint16_t y_pos;
	
	uint16_t latest_x_pos;
	uint16_t latest_y_pos;	

	uint16_t down_x_pos;
	uint16_t down_y_pos;		
//////for ismoving////////////////////////
  uint16_t last_x_pos;
  uint16_t last_y_pos;


/////////////////////////////
	uint8 t_status;	
	uint8 gesture_status;
  uint8 direction;	
	uint32_t timer_count;	
	uint32_t down_time;	
	uint32_t last_time;
  uint8 send_flag;	
  uint8 send_buf;		
	uint8 repeat_en;

} touch_t; 







uint8 handleEvents(void);
void MotionInit(void);
extern unsigned char sliderCoords;
extern touch_t touch;
//
#endif	/* SIMPLE_MOTION_Code */
